<!DOCTYPE HTML>
<html>

<head>
    <meta name="renderer" content="webkit">
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>恒达汽修有限公司</title>

    <link rel="stylesheet" type="text/css" href="css/meteinfo_ui.css" id="metuimodule" data-module="1"/>
    <link rel="stylesheet" type="text/css" href="css/metinfo.css"/>
    <script src="js/jQuery1.7.2.js" type="text/javascript"></script>
    <script src="js/metinfo_ui.js" type="text/javascript"></script>
    <script src="js/ch.js" type="text/javascript"></script>
    <script type="text/javascript" src="/admin/utils/page/js/jqpaginator.min.js"></script>


    <!--[if IE]>
    <script src="public/js/html5.js" type="text/javascript"></script>
    <![endif]-->
</head>

<body>
<div class="m-nav">
    <nav class="inner">
        <ul class="list-none">
            <li id="nav_10001" style='width:123px;'><a href='index.html' title='网站首页' class='nav'><span>网站首页</span></a>
            </li>
            <li id='nav_1' style='width:123px;'><a href='about.html' 0 title='关于我们'
                                                   class='hover-none nav'><span>关于我们</span></a></li>
            <li id='nav_2' style='width:123px;' class='navdown'><a href='news.html' title='信息中心' class='hover-none nav'><span>信息中心</span></a>
            </li>
            <li id='nav_3' style='width:123px;'><a href='product.html' title='恒达汽修产品' class='hover-none nav'><span>恒达汽修产品</span></a>
            </li>
            <li id='nav_4' style='width:122px;'><a href='cases.html' title='服务车型'
                                                   class='hover-none nav'><span>服务车型</span></a></li>
            <li id='nav_34' style='width:122px;'><a href='joinUs.html' title='在线招聘'
                                                    class='hover-none nav'><span>在线招聘</span></a></li>
            <li id='nav_11' style='width:122px;'><a href='booking.html' title='在线预约'
                                                    class='hover-none nav'><span>在线预约</span></a></li>
            <li id='nav_18' style='width:122px;'><a href='contact.html' title='联系我们'
                                                    class='hover-none nav'><span>联系我们</span></a></li>
        </ul>
    </nav>
</div>


<header>
    <div class="inner top">

        <a href="../" title="汽配公司" id="web_logo">
            <img src="img/1363847903.png" style="width: 210px; height: 55px;" alt="汽配公司" title="汽配公司"
                 style="margin:0px 0px 0px 10px;"/>
        </a>

        <div class="top-seo">
            <div class="tpseotxt">
                <p>
                    &nbsp;020-5856-1762</p>
            </div>
        </div>
    </div>
</header>

<div class="inner met_flash">
    <div class="flash">
        <img src='img/1363850250.jpg' width='980' alt='' height='300'>
    </div>
</div>

<div class="sidebar inner">

    <div class="sb_nav">

        <h3 class='title'>信息中心</h3>
        <div class="active b-r" id="sidebar" data-csnow="2" data-class3="0" data-jsok="2">
        </div>

        <h3 class='title line'>联系方式</h3>
        <div class="active editor b-r">
            <div> 电话：020-5856-1762</div>
            <div> 手机：15521389512</div>
            <div> QQ：913405314</div>
            <div> 联系人：谭先生</div>
            <div> 邮箱：hengdaqixiu@163.com</div>
            <div> 邮编：404100</div>
            <div class="clear"></div>
        </div>

    </div>

    <div class='sb_box b-r'>
        <h3 class="title_ title">
        </h3>
        <div class="clear"></div>

        <div class="active" id="newslist">
            <ul class='list-none metlist' style="height: 400px;">

            </ul>
            <div id="page" class="pagination" style="margin-left: 35%">
                <div id="flip">
                    <div class='digg4 metpager_8'>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="clear"></div>
</div>

<footer class="inner">
    <div class="foot-nav">
        <a href="about.html" title='关于我们'>关于我们</a><span>|</span>
        <a href='feedback.html' title='客户留言'>客户留言</a><span>|</span>
        <a href='booking.html' title='在线预约'>在线预约</a><span>|</span>
        <a href='joinUs.html' title='人才招聘'>人才招聘</a><span>|</span>
        <a href='contact.html' title='网站地图'>联系我们</a>
    </div>
    <div class="foot-text">
        <p>恒达汽修有限公司版权所有 2017-2018 备案号：渝ICP备13004606</p>
        <p>电话：020-5856-1762</p>
    </div>
</footer>

<script type="text/javascript">

    /* 转换时间 */
    function transDate(mescStr) {  //格式化时间方法
        var n = mescStr;
        var date = new Date(n);
        var Y = date.getFullYear() + '-';
        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
        var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()+' ';
        return (Y + M + D )
    }

    /* 查询新闻类型 */
    function queryNewsType(typeId) {
        $.ajax({
            url: "/selectNewsTypeList",
            type: "post",
            data: {},
            dataType: "json",
            success: function (data) {
                for(var i = 0; i < data.data.length; i++){
                    var newsTypes = data.data[i];
                    $("#sidebar").append("<dl class='list-none navnow'><dt id='part2_19'><a href='news_classify.html?typeId="+newsTypes.typeId+"' title='"+newsTypes.typeName+"' class='zm'><span>"+newsTypes.typeName+"</span></a></dt></dl>");
                    if(typeId == newsTypes.typeId){
                        $(".title_").append("<div class='position'>当前位置：<a href='/car/index.html' title=\"网站首页\">网站首页</a> &gt; <a href='/car/news.html' >信息中心</a> > <a href='#'>"+newsTypes.typeName+"</a></div><span>"+newsTypes.typeName+"</span>");
                    }
                }
            }
        });
    }

    $(function(){
        var typeId = parseInt(GetQueryString("typeId"));
        queryNewsType(typeId);
        query(typeId);
    });

    /* 得到之前的页面穿过来的新闻类型编号 */
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

    /* 查询所有新闻，默认查询行业新闻 */
    function query(typeId) {
        $.ajax({
            url: "/queryBytypeId",
            type: "post",
            data: {pageNum: 1,typeId:typeId},
            dataType: "json",
            success: function (data) {
                var  pages = null;
                if (data.status == 200) {
                    pages = data.data.pages;
                }else {
                    pages = 1;
                }
                $.jqPaginator(".metpager_8", {
                    totalPages: pages,
                    first: '<a href="javascript:void(0);">«</a>',
                    prev: '<a href="javascript:;">‹</a>',
                    next: '<a href="javascript:void(0);">›</a>',
                    last: '<a href="javascript:void(0);">»</a>',
                    page: '<a href="javascript:;">{{page}}</a>',
                    onPageChange: function (num) {
                        $(".metlist").empty();
                        $.ajax({        //显示分页数据
                            url: "/queryBytypeId",
                            type: "post",
                            data: {pageNum: num, typeId:typeId},
                            dataType: "json",
                            success: function (data) {
                                if (data.status == 200) {
                                    var news = data.data.list;
                                    for (var i = 0; i < news.length; i++) {
                                        console.log(news[i].newsTitle);
                                        $(".metlist").append("<li class='list top'><span>" + transDate(news[i].newsDate) + "</span><a href='news_detail.html?newsId="+news[i].newsId+"' title='" + news[i].newsTitle + "' target='_self'>" + news[i].newsTitle + "</a></li>");
                                    }
                                } else {
                                    $(".metlist").append("<li class='list top'>暂无新闻</li>");
                                }
                            }
                        });
                    }
                });
            }
        })
    }

</script>

</body>

</html>
